<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/validate.jsp"%>
<%@ include file="/common/piny.jsp"%>
<%
    String key = input.getDesc("key", "-1");
    List<Map> experts = QBuilder.db("basedb").select("new map(e.id as id, e.name as name, (case when e.expertId is NULL then '' else e.expertId end) as expert_id, (case when e.avatar is NULL then '' else e.avatar end) as avatar, (case when e.title is NULL then '' else e.title end) as title)").from("Expert e").where(new Where("e.hospital=", hospital).and("e.status = ", STATUS_ENABLE)).group("expert_id").query().getResultObj();
    if (isEmpty(experts)) {
        msg = new Message(30041, "没有任何搜索记录");
        msg.put("data", new ArrayList());
        Tools.encryptPrint(out, msg);
        return;
    }
    List<Map> tempList = new ArrayList<Map>();
    for (int i = 0; i < experts.size(); i++) {
        Map map = experts.get(i);
        String name = Tools.getDesc(map.get("name"), "");
        String qpyName = getPingYin(name);
        String hpyName = getPinYinHeadChar(name);
        if (name.contains(key) || qpyName.contains(key) || hpyName.contains(key)) {
            tempList.add(map);
        }
    }
    if (isEmpty(tempList)) {
        msg = new Message(30041, "没有任何搜索记录");
        msg.put("data", new ArrayList());
        Tools.encryptPrint(out, msg);
        return;
    }
    msg.put("data", tempList);
    Tools.encryptPrint(out, msg);
%>
